package ch11;

import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

class _11_HashSetLotto {
	public static void main(String[] args) {
		Set<Integer> set = new HashSet<Integer>();

		for (int i = 0; set.size() < 6; i++) 
			set.add((int)(Math.random() * 45) + 1);

		List<Integer> list = new LinkedList<Integer>(set); 
		Collections.sort(list); 
		System.out.println(list); // [7, 15, 20, 25, 30, 37]
	}
}